﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String item=request.getParameter("item");
String authority ="";
int  usernumber=0,needCheck=0,needApply=0;
if(session.getAttribute("authority")!=null){
	authority =session.getAttribute("authority").toString(); 
}else{
	out.print("<script>window.location.href='login.jsp';</script>");
}
/*if(session.getAttribute("needCheck")!=null){
	needCheck=Integer.parseInt(session.getAttribute("needCheck").toString());
}
if(session.getAttribute("needApplay")!=null){
	needApply=Integer.parseInt(session.getAttribute("needApplay").toString());
}
if(session.getAttribute("usernumber")!=null){
	usernumber=Integer.parseInt(session.getAttribute("usernumber").toString());
}*/
%>
<!DOCTYPE html>
<html lang="">
<head>
	<meta charset="utf-8">
	<title>公司差旅管理系统</title>
	<meta name="description" content="" />
	<meta name="keywords" content="" />
	<meta name="robots" content="" />
	<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
	<link rel="stylesheet" href="css/style.css" media="all" />
	
	<link type="text/css" rel="stylesheet" href="css/calendar.css" >
	<!--[if IE]><link rel="stylesheet" href="css/ie.css" media="all" /><![endif]-->
	<!--[if lt IE 9]><link rel="stylesheet" href="css/lt-ie-9.css" media="all" /><![endif]-->
	<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
</head>
<body>
<div class="testing">
<header class="main">
	<h1>公司差旅管理系统</h1>
</header>
<section class="user">
	<div class="profile-img">
		<p><img src="images/admin.jpg" alt="" height="40" width="40" /> 欢迎登录公司差旅管理系统</p>
	</div>
	<div class="buttons">
		<span class="button"><a href="loadUserInfo">个人中心</a></span>
		<span class="button blue"><a href="userInfoAction!logout.action">退出</a></span>
	</div>
</section>
</div>
<!-- 菜单导航栏 -->
<nav id="navs">
	<ul>
	<%if(authority.equals("管理员")){ %>
		<li id="item1"><a href="showchart!prepareSetting.action" ><span class="icon">&#128202;</span>差旅统计</a></li>
		<li id="item2">
			<a href="departmentManage" ><span class="icon">&#9881;</span>信息管理</a>
			<ul class="submenu">
				<li><a href="departmentManage" >部门信息管理</a></li>
				<li><a href="userGroupManage" >用户组管理</a></li>
				<li><a href="travelStandard.jsp" >差旅标准管理</a></li>
				<li><a href="ruleManage">点数兑换管理</a></li>
			</ul>	
		</li>
		<li id="item3">
			<a href="selectinfo.jsp" ><span class="icon">&#128196;</span>信息查询</a>
		</li>
		<li  id="item4">
			<a href="verifierAction!getTravelListByStatus.action" ><span class="icon">&#128711;</span> 差旅审核<span class="pip" ><b id="bpip"></b></span><span class="info-hint" id="info_hint"></span></a>
		</li>
		<%} %>
		<li id = "item5">
			<a href="route!routeSetPrepareSetting.action" ><span class="icon">&#128319;</span> 差旅管理</a>
			<ul class="submenu">
				<li><a href="route!routeSetPrepareSetting.action" id="routeSeting">路线制定</a></li>
				<li><a href="applayReimAction!getNoApplayTravelList.action">报销申请</a></li>
				<li><a href="personTravelInfoAction!getPersonTravelList.action">个人出差记录</a></li>
				<li><a href="http://www.tuniu.com/" target="_blank">酒店/车票预订</a></li>
			</ul>
		</li>
		<%if(authority.equals("管理员")){ %>
		<li id="item6"><a href="userManage.jsp" ><span class="icon">&#128101;</span> 员工管理 <span class="pip"><b id="upip"></b></span></a></li>
		<%} %>
	</ul>
</nav>
<%if(authority.equals("管理员")){ %>
<!-- 消息提醒 -->
<section class="alert">
	<div class="green">	
		<p>Hi <%=session.getAttribute("username").toString() %>, 
		你有 <a href="verifierAction!getTravelListByStatus.action"><b id="bapply"></b>条出差申请</a>
		和<a href="verifierAction!getTravelListByStatus.action"><b id="eapply"></b>条报销申请</a> 
		待审核, 请尽快审核!</p>
		<span class="close">&#10006;</span>
	</div>
</section>
<%} %>
<script type="text/javascript" src="js/comet4j.js"></script>
<script>
	var now_apply;
	var if_first=0;
 	var bapply=document.getElementById("bapply");
 	var eapply=document.getElementById("eapply");
 	var bpip=document.getElementById("bpip");
 	var upip=document.getElementById("upip");
 	var info_hint=document.getElementById("info_hint");
 	
 	JS.Engine.on({
 		message: function(content){
 			
 			//var content=eval("("+content+")");
 			bapply.innerHTML=content[1];
 			eapply.innerHTML=content[2];
 			bpip.innerHTML=content[1]+content[2];
 			upip.innerHTML=content[0];
 			if(if_first==1){	//后面的每次都判断
 				if((content[1]+content[2])>now_apply){
 					var i=content[1]+content[2]-now_apply;
 					info_hint.innerHTML='+'+i;
 					info_hint.style.display="block";
 					/*layer.tips('+1', '#bpip', {
					    tips: [1, '#3595CC'],
					    time: 4000
					});*/
 				}
 				/*if(content[2]>now_eapply){
 					layer.tips('+1', '#bpip', {
					    tips: [1, '#3595CC'],
					    time: 4000
					});
 				}*/
	 		}else{
	 			now_apply=content[1]+content[2];	//一开始加载后
	 			if_first=1;
	 		}
	 		/*now_bapply=content[1];
	 		now_eapply=content[2];*/
 		}
 	});
 	JS.Engine.start("conn");	//浏览器与服务器的连接
 	JS.Engine.on(
 	"start",function(cId,channelList,engine){	//成功连接触发的事件
 		
 	})

	var item=<%=item%>;
	(function(){
	    var oTab = document.getElementById("navs");
	    var oUl = oTab.getElementsByTagName("ul")[0];
	    var oLis = oUl.getElementsByTagName("li");
		
	    for(var i= 0,len = oLis.length;i<len;i++){
	    	oLis[i].className = "";
	    }
		item.className="section";
		$(item).find('ul').show();
	}(item));
</script>
